package com.atguigu.boot.config;

import com.atguigu.boot.bean.User;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;

/**
 * @author DongZH
 * @date 2024/3/29 14:09
 */
@Configuration  // 配置类，替代以前的配置类
public class AppConfig {

    @Scope(value = "prototype")
    @Bean("userHaHa")  // 替代以前的Bean标签
    public User user() {
        User user = new User();
        user.setId(1L);
        user.setName("zhangsan");
        return user;
    }
}
